<script setup lang="ts">
import { ref, onMounted } from 'vue'
import axios from 'axios'

const testCases = ref([])

// 从 Django 后端获取数据
onMounted(async () => {
  try {
    const response = await axios.get('http://127.0.0.1:8000/api/test-cases/')
    testCases.value = response.data
  } catch (error) {
    console.error('获取用例失败:', error)
  }
})
</script>

<template>
  <div>
    <h2>测试用例管理</h2>
    <ul>
      <li v-for="tc in testCases" :key="tc.id">{{ tc.name }} - {{ tc.method }} {{ tc.url }}</li>
    </ul>
  </div>
</template>
